import Vue from 'vue'
import App from './App.vue'
import router from './router/index'

// 带入element和axios
import ElementUI from 'element-ui';
import Axios from 'axios';
import 'element-ui/lib/theme-chalk/index.css';
// Axios.defaults.baseURL = "http://www.pawntest.com/";
Axios.defaults.baseURL = "http://localhost:81/";
// 前端跨域 允许cookie跨域
Axios.defaults.withCredentials = true;
// 前端拦截器

Axios.interceptors.response.use(function(resp){
	if(resp.data.code == 5000){
		console.log("=======")
		localStorage.removeItem("adminRoot");
		router.push("/");
	}
	return resp;
})


Vue.prototype.$http = Axios;
// 清除session
// localStorage.removeItem("adminRoot")
Vue.use(ElementUI);

Vue.config.productionTip = false

//最终挂载区
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
